package shiyan2;

public class Student {
    private String sID;
    private String sName;
    private String sSex;
    private int sAge;


    public Student(String sID, String sName, String sSex, int sAge) {
        this.sID = sID;
        this.sName = sName;
        setsSex(sSex);
        setsAge(sAge);

    }
    public String getsSex() {
        return sSex;
    }
    public void setsSex(String sSex) {
        if(sSex.equals("男") || sSex.equals("女")) {
            this.sSex = sSex;
        }else {
            System.out.println("性别输入不合法");
            int a  = 2 / 0;
        }
    }
    public int getsAge() {
        return sAge;
    }
    public void setsAge(int sAge) {
        if(sAge >= 10 && sAge <= 50) {
            this.sAge = sAge;
        }else {
            System.out.println("年龄在10到50之间，输入不合法");
            int a  = 2 / 0;
        }
    }
    public String getsID() {
        return sID;
    }
    public void setsID(String sID) {
        this.sID = sID;
    }
    public String getsName() {
        return sName;
    }
    public void setsName(String sName) {
        this.sName = sName;
    }
}
